package com.bruce.demo2.patterns.demo1.creational.demo05.builder.demo1;

/**
 * @PROJECT_NAME design_patterns
 * @DESCRIPTION 指挥者类-组装车子
 * @AUTHOR CNBruceLee
 * @DATE 2021/7/12 22:04
 */
public class Director {
    private Builder builder;

    public Director(Builder builder) {
        this.builder = builder;
    }

    /**
     * 组装的方法
     *
     * @return 自行车
     */
    public Bike construct() {
        //具体组装过程可能有一定的顺序
        this.builder.builderFrame();//组装车架
        this.builder.builderSeat();//组装座椅
        return this.builder.createBike();//返回组装后的自行车
    }
}
